#include<stdio.h>
int main ()
{
	int year,month,day,num;
	num=0;
	while(scanf("%d-%d-%d",&year,&month,&day)!=EOF)
	{
	switch (month)
	{
	
	case 01:
		num=day;
		break;
	case 02:
		num=day+31;
		break;
	case 03:
		num=day+59;
		break;
	case 04:
		num=day+90;
		break;
	case 05:
		num=day+120;
		break;
	case 06:
		num=day+151;
		break;
	case 07:
		num=day+181;
		break;
	case 8:
		num=day+212;
		break;
	case 9:
		num=day+243;
		break;
	case 10:
		num=day+273;
		break;
	case 11:
		num=day+304;
		break;
	case 12:
		num=day+334;
		break;
	default:
		printf("error!\n");
		
			
	
	
	}

	if ((year%4==0&&year%100!=0||year%400==0)&&month>=3)
	{
		num=num+1;
		
	}
	
		 
	
	
	
	
	printf("%d\n",num);}
	return 0;
 } 

